<?php


/*
* Copyright (c) 2008-2016 vip.com, All Rights Reserved.
*
* Powered by com.vip.osp.osp-idlc-2.5.11.
*
*/

namespace com\vip\hcscm\purchase\service;

class QueryAliProductDataResp {
	
	static $_TSPEC;
	public $code = null;
	public $msg = null;
	public $skus = null;
	public $material = null;
	public $productID = null;
	public $sellerLoginId = null;
	public $subject = null;
	public $imgList = null;
	public $aliShopInfo = null;
	
	public function __construct($vals=null){
		
		if (!isset(self::$_TSPEC)){
			
			self::$_TSPEC = array(
			10001 => array(
			'var' => 'code'
			),
			10002 => array(
			'var' => 'msg'
			),
			1 => array(
			'var' => 'skus'
			),
			2 => array(
			'var' => 'material'
			),
			3 => array(
			'var' => 'productID'
			),
			4 => array(
			'var' => 'sellerLoginId'
			),
			5 => array(
			'var' => 'subject'
			),
			6 => array(
			'var' => 'imgList'
			),
			7 => array(
			'var' => 'aliShopInfo'
			),
			
			);
			
		}
		
		if (is_array($vals)){
			
			
			if (isset($vals['code'])){
				
				$this->code = $vals['code'];
			}
			
			
			if (isset($vals['msg'])){
				
				$this->msg = $vals['msg'];
			}
			
			
			if (isset($vals['skus'])){
				
				$this->skus = $vals['skus'];
			}
			
			
			if (isset($vals['material'])){
				
				$this->material = $vals['material'];
			}
			
			
			if (isset($vals['productID'])){
				
				$this->productID = $vals['productID'];
			}
			
			
			if (isset($vals['sellerLoginId'])){
				
				$this->sellerLoginId = $vals['sellerLoginId'];
			}
			
			
			if (isset($vals['subject'])){
				
				$this->subject = $vals['subject'];
			}
			
			
			if (isset($vals['imgList'])){
				
				$this->imgList = $vals['imgList'];
			}
			
			
			if (isset($vals['aliShopInfo'])){
				
				$this->aliShopInfo = $vals['aliShopInfo'];
			}
			
			
		}
		
	}
	
	
	public function getName(){
		
		return 'QueryAliProductDataResp';
	}
	
	public function read($input){
		
		$input->readStructBegin();
		while(true){
			
			$schemeField = $input->readFieldBegin();
			if ($schemeField == null) break;
			$needSkip = true;
			
			
			if ("code" == $schemeField){
				
				$needSkip = false;
				$input->readI32($this->code); 
				
			}
			
			
			
			
			if ("msg" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->msg);
				
			}
			
			
			
			
			if ("skus" == $schemeField){
				
				$needSkip = false;
				
				$this->skus = array();
				$_size0 = 0;
				$input->readListBegin();
				while(true){
					
					try{
						
						$elem0 = null;
						
						$elem0 = new \com\vip\hcscm\purchase\service\AliSkuResp();
						$elem0->read($input);
						
						$this->skus[$_size0++] = $elem0;
					}
					catch(\Exception $e){
						
						break;
					}
				}
				
				$input->readListEnd();
				
			}
			
			
			
			
			if ("material" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->material);
				
			}
			
			
			
			
			if ("productID" == $schemeField){
				
				$needSkip = false;
				$input->readI64($this->productID); 
				
			}
			
			
			
			
			if ("sellerLoginId" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->sellerLoginId);
				
			}
			
			
			
			
			if ("subject" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->subject);
				
			}
			
			
			
			
			if ("imgList" == $schemeField){
				
				$needSkip = false;
				
				$this->imgList = array();
				$_size1 = 0;
				$input->readListBegin();
				while(true){
					
					try{
						
						$elem1 = null;
						$input->readString($elem1);
						
						$this->imgList[$_size1++] = $elem1;
					}
					catch(\Exception $e){
						
						break;
					}
				}
				
				$input->readListEnd();
				
			}
			
			
			
			
			if ("aliShopInfo" == $schemeField){
				
				$needSkip = false;
				
				$this->aliShopInfo = new \com\vip\hcscm\purchase\service\AliShopInfoVo();
				$this->aliShopInfo->read($input);
				
			}
			
			
			
			if($needSkip){
				
				\Osp\Protocol\ProtocolUtil::skip($input);
			}
			
			$input->readFieldEnd();
		}
		
		$input->readStructEnd();
		
		
		
	}
	
	public function write($output){
		
		$xfer = 0;
		$xfer += $output->writeStructBegin();
		
		$xfer += $output->writeFieldBegin('code');
		$xfer += $output->writeI32($this->code);
		
		$xfer += $output->writeFieldEnd();
		
		if($this->msg !== null) {
			
			$xfer += $output->writeFieldBegin('msg');
			$xfer += $output->writeString($this->msg);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->skus !== null) {
			
			$xfer += $output->writeFieldBegin('skus');
			
			if (!is_array($this->skus)){
				
				throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
			}
			
			$output->writeListBegin();
			foreach ($this->skus as $iter0){
				
				
				if (!is_object($iter0)) {
					
					throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
				}
				
				$xfer += $iter0->write($output);
				
			}
			
			$output->writeListEnd();
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->material !== null) {
			
			$xfer += $output->writeFieldBegin('material');
			$xfer += $output->writeString($this->material);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->productID !== null) {
			
			$xfer += $output->writeFieldBegin('productID');
			$xfer += $output->writeI64($this->productID);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->sellerLoginId !== null) {
			
			$xfer += $output->writeFieldBegin('sellerLoginId');
			$xfer += $output->writeString($this->sellerLoginId);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->subject !== null) {
			
			$xfer += $output->writeFieldBegin('subject');
			$xfer += $output->writeString($this->subject);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->imgList !== null) {
			
			$xfer += $output->writeFieldBegin('imgList');
			
			if (!is_array($this->imgList)){
				
				throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
			}
			
			$output->writeListBegin();
			foreach ($this->imgList as $iter0){
				
				$xfer += $output->writeString($iter0);
				
			}
			
			$output->writeListEnd();
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->aliShopInfo !== null) {
			
			$xfer += $output->writeFieldBegin('aliShopInfo');
			
			if (!is_object($this->aliShopInfo)) {
				
				throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
			}
			
			$xfer += $this->aliShopInfo->write($output);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldStop();
		$xfer += $output->writeStructEnd();
		return $xfer;
	}
	
}

?>